﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Shader
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine.Bindings;
using UnityEngine.Rendering;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Shader scripts used for all rendering.</para>
  /// </summary>
  [NativeHeader("Runtime/Graphics/ShaderScriptBindings.h")]
  [NativeHeader("Runtime/Shaders/Keywords/KeywordSpaceScriptBindings.h")]
  [NativeHeader("Runtime/Misc/ResourceManager.h")]
  [NativeHeader("Runtime/Graphics/ShaderScriptBindings.h")]
  [NativeHeader("Runtime/Shaders/Shader.h")]
  [NativeHeader("Runtime/Shaders/GpuPrograms/ShaderVariantCollection.h")]
  [NativeHeader("Runtime/Shaders/ShaderNameRegistry.h")]
  [NativeHeader("Runtime/Shaders/ComputeShader.h")]
  public sealed class Shader : Object
  {
    [EditorBrowsable(EditorBrowsableState.Never)]
    [Obsolete("SetGlobalTexGenMode is not supported anymore. Use programmable shaders to achieve the same effect.", true)]
    public static void SetGlobalTexGenMode(string propertyName, TexGenMode mode)
    {
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    [Obsolete("SetGlobalTextureMatrixName is not supported anymore. Use programmable shaders to achieve the same effect.", true)]
    public static void SetGlobalTextureMatrixName(string propertyName, string matrixName)
    {
    }

    /// <summary>
    ///   <para>Shader hardware tier classification for current device.</para>
    /// </summary>
    [Obsolete("Use Graphics.activeTier instead (UnityUpgradable) -> UnityEngine.Graphics.activeTier", false)]
    public static ShaderHardwareTier globalShaderHardwareTier
    {
      get => (ShaderHardwareTier) Graphics.activeTier;
      set => Graphics.activeTier = (GraphicsTier) value;
    }

    /// <summary>
    ///   <para>Finds a shader with the given name. Returns null if the shader is not found.</para>
    /// </summary>
    /// <param name="name"></param>
    public static Shader Find(string name) => ResourcesAPI.ActiveAPI.FindShaderByName(name);

    [FreeFunction("GetBuiltinResource<Shader>")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern Shader FindBuiltin(string name);

    /// <summary>
    ///   <para>Sets the limit on the number of shader variant chunks Unity loads and keeps in memory.</para>
    /// </summary>
    [NativeProperty("MaxChunksRuntimeOverride")]
    public static extern int maximumChunksOverride { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Shader LOD level for this shader.</para>
    /// </summary>
    [NativeProperty("MaximumShaderLOD")]
    public extern int maximumLOD { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Shader LOD level for all shaders.</para>
    /// </summary>
    [NativeProperty("GlobalMaximumShaderLOD")]
    public static extern int globalMaximumLOD { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Can this shader run on the end-users graphics card? (Read Only)</para>
    /// </summary>
    public extern bool isSupported { [NativeMethod("IsSupported"), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Render pipeline currently in use.</para>
    /// </summary>
    public static extern string globalRenderPipeline { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>An array containing the global shader keywords that are currently enabled.</para>
    /// </summary>
    public static GlobalKeyword[] enabledGlobalKeywords => Shader.GetEnabledGlobalKeywords();

    /// <summary>
    ///   <para>An array containing the global shader keywords that currently exist. This includes enabled and disabled global shader keywords.</para>
    /// </summary>
    public static GlobalKeyword[] globalKeywords => Shader.GetAllGlobalKeywords();

    /// <summary>
    ///   <para>The local keyword space of this shader.</para>
    /// </summary>
    public LocalKeywordSpace keywordSpace
    {
      get
      {
        LocalKeywordSpace ret;
        this.get_keywordSpace_Injected(out ret);
        return ret;
      }
    }

    [FreeFunction("keywords::GetEnabledGlobalKeywords")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern GlobalKeyword[] GetEnabledGlobalKeywords();

    [FreeFunction("keywords::GetAllGlobalKeywords")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern GlobalKeyword[] GetAllGlobalKeywords();

    /// <summary>
    ///   <para>Enables a global shader keyword.</para>
    /// </summary>
    /// <param name="keyword">The Rendering.GlobalKeyword to enable.</param>
    /// <param name="keyword">The name of the Rendering.GlobalKeyword to enable.</param>
    [FreeFunction("ShaderScripting::EnableKeyword")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void EnableKeyword(string keyword);

    /// <summary>
    ///   <para>Disables a global shader keyword.</para>
    /// </summary>
    /// <param name="keyword">The Rendering.GlobalKeyword to disable.</param>
    /// <param name="keyword">The name of the Rendering.GlobalKeyword to disable.</param>
    [FreeFunction("ShaderScripting::DisableKeyword")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void DisableKeyword(string keyword);

    /// <summary>
    ///   <para>Checks whether a global shader keyword is enabled.</para>
    /// </summary>
    /// <param name="keyword">The name of the Rendering.GlobalKeyword to check.</param>
    /// <returns>
    ///   <para>Returns true if a global shader keyword with the given name exists, and is enabled. Otherwise, returns false.</para>
    /// </returns>
    [FreeFunction("ShaderScripting::IsKeywordEnabled")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern bool IsKeywordEnabled(string keyword);

    [FreeFunction("ShaderScripting::EnableKeyword")]
    internal static void EnableKeywordFast(GlobalKeyword keyword)
    {
      Shader.EnableKeywordFast_Injected(ref keyword);
    }

    [FreeFunction("ShaderScripting::DisableKeyword")]
    internal static void DisableKeywordFast(GlobalKeyword keyword)
    {
      Shader.DisableKeywordFast_Injected(ref keyword);
    }

    [FreeFunction("ShaderScripting::SetKeyword")]
    internal static void SetKeywordFast(GlobalKeyword keyword, bool value)
    {
      Shader.SetKeywordFast_Injected(ref keyword, value);
    }

    [FreeFunction("ShaderScripting::IsKeywordEnabled")]
    internal static bool IsKeywordEnabledFast(GlobalKeyword keyword)
    {
      return Shader.IsKeywordEnabledFast_Injected(ref keyword);
    }

    public static void EnableKeyword(in GlobalKeyword keyword) => Shader.EnableKeywordFast(keyword);

    public static void DisableKeyword(in GlobalKeyword keyword)
    {
      Shader.DisableKeywordFast(keyword);
    }

    public static void SetKeyword(in GlobalKeyword keyword, bool value)
    {
      Shader.SetKeywordFast(keyword, value);
    }

    public static bool IsKeywordEnabled(in GlobalKeyword keyword)
    {
      return Shader.IsKeywordEnabledFast(keyword);
    }

    /// <summary>
    ///   <para>Render queue of this shader. (Read Only)</para>
    /// </summary>
    public extern int renderQueue { [FreeFunction("ShaderScripting::GetRenderQueue", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    internal extern DisableBatchingType disableBatching { [FreeFunction("ShaderScripting::GetDisableBatchingType", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Prewarms all shader variants of all Shaders currently in memory.</para>
    /// </summary>
    [FreeFunction]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void WarmupAllShaders();

    [FreeFunction("ShaderScripting::TagToID")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern int TagToID(string name);

    [FreeFunction("ShaderScripting::IDToTag")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern string IDToTag(int name);

    /// <summary>
    ///   <para>Gets unique identifier for a shader property name.</para>
    /// </summary>
    /// <param name="name">Shader property name.</param>
    /// <returns>
    ///   <para>Unique integer for the name.</para>
    /// </returns>
    [FreeFunction(Name = "ShaderScripting::PropertyToID", IsThreadSafe = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern int PropertyToID(string name);

    /// <summary>
    ///   <para>Returns the dependency shader.</para>
    /// </summary>
    /// <param name="name">The name of the dependency to query.</param>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern Shader GetDependency(string name);

    /// <summary>
    ///   <para>Returns the number of shader passes on the active SubShader.</para>
    /// </summary>
    public extern int passCount { [FreeFunction(Name = "ShaderScripting::GetPassCount", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Returns the number of SubShaders in this shader.</para>
    /// </summary>
    public extern int subshaderCount { [FreeFunction(Name = "ShaderScripting::GetSubshaderCount", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Returns the number of passes in the given SubShader.</para>
    /// </summary>
    /// <param name="subshaderIndex">The index of the SubShader.</param>
    [FreeFunction(Name = "ShaderScripting::GetPassCountInSubshader", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern int GetPassCountInSubshader(int subshaderIndex);

    /// <summary>
    ///   <para>Searches for the tag specified by tagName on the shader's active SubShader and returns the value of the tag.</para>
    /// </summary>
    /// <param name="passIndex">The index of the pass.</param>
    /// <param name="tagName">The name of the tag.</param>
    public ShaderTagId FindPassTagValue(int passIndex, ShaderTagId tagName)
    {
      if (passIndex < 0 || passIndex >= this.passCount)
        throw new ArgumentOutOfRangeException(nameof (passIndex));
      int passTagValue = this.Internal_FindPassTagValue(passIndex, tagName.id);
      return new ShaderTagId() { id = passTagValue };
    }

    /// <summary>
    ///   <para>Searches for the tag specified by tagName on the SubShader specified by subshaderIndex and returns the value of the tag.</para>
    /// </summary>
    /// <param name="subshaderIndex">The index of the SubShader.</param>
    /// <param name="passIndex">The index of the pass.</param>
    /// <param name="tagName">The name of the tag.</param>
    public ShaderTagId FindPassTagValue(int subshaderIndex, int passIndex, ShaderTagId tagName)
    {
      if (subshaderIndex < 0 || subshaderIndex >= this.subshaderCount)
        throw new ArgumentOutOfRangeException(nameof (subshaderIndex));
      if (passIndex < 0 || passIndex >= this.GetPassCountInSubshader(subshaderIndex))
        throw new ArgumentOutOfRangeException(nameof (passIndex));
      int valueInSubShader = this.Internal_FindPassTagValueInSubShader(subshaderIndex, passIndex, tagName.id);
      return new ShaderTagId() { id = valueInSubShader };
    }

    /// <summary>
    ///   <para>Searches for the tag specified by tagName on the SubShader specified by subshaderIndex and returns the value of the tag.</para>
    /// </summary>
    /// <param name="subshaderIndex">The index of the SubShader.</param>
    /// <param name="tagName">The name of the tag.</param>
    public ShaderTagId FindSubshaderTagValue(int subshaderIndex, ShaderTagId tagName)
    {
      if (subshaderIndex < 0 || subshaderIndex >= this.subshaderCount)
        throw new ArgumentOutOfRangeException(string.Format("Invalid subshaderIndex {0}. Value must be in the range [0, {1})", (object) subshaderIndex, (object) this.subshaderCount));
      int subshaderTagValue = this.Internal_FindSubshaderTagValue(subshaderIndex, tagName.id);
      return new ShaderTagId() { id = subshaderTagValue };
    }

    [FreeFunction(Name = "ShaderScripting::FindPassTagValue", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int Internal_FindPassTagValue(int passIndex, int tagName);

    [FreeFunction(Name = "ShaderScripting::FindPassTagValue", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int Internal_FindPassTagValueInSubShader(
      int subShaderIndex,
      int passIndex,
      int tagName);

    [FreeFunction(Name = "ShaderScripting::FindSubshaderTagValue", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern int Internal_FindSubshaderTagValue(int subShaderIndex, int tagName);

    [NativeProperty("CustomEditorName")]
    internal extern string customEditor { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    [FreeFunction(Name = "ShaderScripting::GetCustomEditorForRenderPipeline", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    internal extern void Internal_GetCustomEditorForRenderPipeline(
      string renderPipelineType,
      out string customEditor);

    [FreeFunction("ShaderScripting::SetGlobalInt")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalIntImpl(int name, int value);

    [FreeFunction("ShaderScripting::SetGlobalFloat")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalFloatImpl(int name, float value);

    [FreeFunction("ShaderScripting::SetGlobalVector")]
    private static void SetGlobalVectorImpl(int name, Vector4 value)
    {
      Shader.SetGlobalVectorImpl_Injected(name, ref value);
    }

    [FreeFunction("ShaderScripting::SetGlobalMatrix")]
    private static void SetGlobalMatrixImpl(int name, Matrix4x4 value)
    {
      Shader.SetGlobalMatrixImpl_Injected(name, ref value);
    }

    [FreeFunction("ShaderScripting::SetGlobalTexture")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalTextureImpl(int name, Texture value);

    [FreeFunction("ShaderScripting::SetGlobalRenderTexture")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalRenderTextureImpl(
      int name,
      RenderTexture value,
      RenderTextureSubElement element);

    [FreeFunction("ShaderScripting::SetGlobalBuffer")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalBufferImpl(int name, ComputeBuffer value);

    [FreeFunction("ShaderScripting::SetGlobalBuffer")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalGraphicsBufferImpl(int name, GraphicsBuffer value);

    [FreeFunction("ShaderScripting::SetGlobalConstantBuffer")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalConstantBufferImpl(
      int name,
      ComputeBuffer value,
      int offset,
      int size);

    [FreeFunction("ShaderScripting::SetGlobalConstantBuffer")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalConstantGraphicsBufferImpl(
      int name,
      GraphicsBuffer value,
      int offset,
      int size);

    [FreeFunction("ShaderScripting::GetGlobalInt")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetGlobalIntImpl(int name);

    [FreeFunction("ShaderScripting::GetGlobalFloat")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern float GetGlobalFloatImpl(int name);

    [FreeFunction("ShaderScripting::GetGlobalVector")]
    private static Vector4 GetGlobalVectorImpl(int name)
    {
      Vector4 ret;
      Shader.GetGlobalVectorImpl_Injected(name, out ret);
      return ret;
    }

    [FreeFunction("ShaderScripting::GetGlobalMatrix")]
    private static Matrix4x4 GetGlobalMatrixImpl(int name)
    {
      Matrix4x4 ret;
      Shader.GetGlobalMatrixImpl_Injected(name, out ret);
      return ret;
    }

    [FreeFunction("ShaderScripting::GetGlobalTexture")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern Texture GetGlobalTextureImpl(int name);

    [FreeFunction("ShaderScripting::SetGlobalFloatArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalFloatArrayImpl(int name, float[] values, int count);

    [FreeFunction("ShaderScripting::SetGlobalVectorArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalVectorArrayImpl(int name, Vector4[] values, int count);

    [FreeFunction("ShaderScripting::SetGlobalMatrixArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalMatrixArrayImpl(int name, Matrix4x4[] values, int count);

    [FreeFunction("ShaderScripting::GetGlobalFloatArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern float[] GetGlobalFloatArrayImpl(int name);

    [FreeFunction("ShaderScripting::GetGlobalVectorArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern Vector4[] GetGlobalVectorArrayImpl(int name);

    [FreeFunction("ShaderScripting::GetGlobalMatrixArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern Matrix4x4[] GetGlobalMatrixArrayImpl(int name);

    [FreeFunction("ShaderScripting::GetGlobalFloatArrayCount")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetGlobalFloatArrayCountImpl(int name);

    [FreeFunction("ShaderScripting::GetGlobalVectorArrayCount")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetGlobalVectorArrayCountImpl(int name);

    [FreeFunction("ShaderScripting::GetGlobalMatrixArrayCount")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetGlobalMatrixArrayCountImpl(int name);

    [FreeFunction("ShaderScripting::ExtractGlobalFloatArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void ExtractGlobalFloatArrayImpl(int name, [Out] float[] val);

    [FreeFunction("ShaderScripting::ExtractGlobalVectorArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void ExtractGlobalVectorArrayImpl(int name, [Out] Vector4[] val);

    [FreeFunction("ShaderScripting::ExtractGlobalMatrixArray")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void ExtractGlobalMatrixArrayImpl(int name, [Out] Matrix4x4[] val);

    private static void SetGlobalFloatArray(int name, float[] values, int count)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      if (values.Length == 0)
        throw new ArgumentException("Zero-sized array is not allowed.");
      if (values.Length < count)
        throw new ArgumentException("array has less elements than passed count.");
      Shader.SetGlobalFloatArrayImpl(name, values, count);
    }

    private static void SetGlobalVectorArray(int name, Vector4[] values, int count)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      if (values.Length == 0)
        throw new ArgumentException("Zero-sized array is not allowed.");
      if (values.Length < count)
        throw new ArgumentException("array has less elements than passed count.");
      Shader.SetGlobalVectorArrayImpl(name, values, count);
    }

    private static void SetGlobalMatrixArray(int name, Matrix4x4[] values, int count)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      if (values.Length == 0)
        throw new ArgumentException("Zero-sized array is not allowed.");
      if (values.Length < count)
        throw new ArgumentException("array has less elements than passed count.");
      Shader.SetGlobalMatrixArrayImpl(name, values, count);
    }

    private static void ExtractGlobalFloatArray(int name, List<float> values)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      values.Clear();
      int floatArrayCountImpl = Shader.GetGlobalFloatArrayCountImpl(name);
      if (floatArrayCountImpl <= 0)
        return;
      NoAllocHelpers.EnsureListElemCount<float>(values, floatArrayCountImpl);
      Shader.ExtractGlobalFloatArrayImpl(name, (float[]) NoAllocHelpers.ExtractArrayFromList((object) values));
    }

    private static void ExtractGlobalVectorArray(int name, List<Vector4> values)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      values.Clear();
      int vectorArrayCountImpl = Shader.GetGlobalVectorArrayCountImpl(name);
      if (vectorArrayCountImpl <= 0)
        return;
      NoAllocHelpers.EnsureListElemCount<Vector4>(values, vectorArrayCountImpl);
      Shader.ExtractGlobalVectorArrayImpl(name, (Vector4[]) NoAllocHelpers.ExtractArrayFromList((object) values));
    }

    private static void ExtractGlobalMatrixArray(int name, List<Matrix4x4> values)
    {
      if (values == null)
        throw new ArgumentNullException(nameof (values));
      values.Clear();
      int matrixArrayCountImpl = Shader.GetGlobalMatrixArrayCountImpl(name);
      if (matrixArrayCountImpl <= 0)
        return;
      NoAllocHelpers.EnsureListElemCount<Matrix4x4>(values, matrixArrayCountImpl);
      Shader.ExtractGlobalMatrixArrayImpl(name, (Matrix4x4[]) NoAllocHelpers.ExtractArrayFromList((object) values));
    }

    /// <summary>
    ///   <para>This method is deprecated. Use SetGlobalFloat or SetGlobalInteger instead.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalInt(string name, int value)
    {
      Shader.SetGlobalFloatImpl(Shader.PropertyToID(name), (float) value);
    }

    /// <summary>
    ///   <para>This method is deprecated. Use SetGlobalFloat or SetGlobalInteger instead.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalInt(int nameID, int value)
    {
      Shader.SetGlobalFloatImpl(nameID, (float) value);
    }

    /// <summary>
    ///   <para>Sets a global float property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalFloat(string name, float value)
    {
      Shader.SetGlobalFloatImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Sets a global float property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalFloat(int nameID, float value)
    {
      Shader.SetGlobalFloatImpl(nameID, value);
    }

    /// <summary>
    ///   <para>Sets a global integer property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalInteger(string name, int value)
    {
      Shader.SetGlobalIntImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Sets a global integer property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalInteger(int nameID, int value)
    {
      Shader.SetGlobalIntImpl(nameID, value);
    }

    /// <summary>
    ///   <para>Sets a global vector property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalVector(string name, Vector4 value)
    {
      Shader.SetGlobalVectorImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Sets a global vector property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalVector(int nameID, Vector4 value)
    {
      Shader.SetGlobalVectorImpl(nameID, value);
    }

    /// <summary>
    ///   <para>Sets a global color property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalColor(string name, Color value)
    {
      Shader.SetGlobalVectorImpl(Shader.PropertyToID(name), (Vector4) value);
    }

    /// <summary>
    ///   <para>Sets a global color property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalColor(int nameID, Color value)
    {
      Shader.SetGlobalVectorImpl(nameID, (Vector4) value);
    }

    /// <summary>
    ///   <para>Sets a global matrix property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalMatrix(string name, Matrix4x4 value)
    {
      Shader.SetGlobalMatrixImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Sets a global matrix property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value"></param>
    public static void SetGlobalMatrix(int nameID, Matrix4x4 value)
    {
      Shader.SetGlobalMatrixImpl(nameID, value);
    }

    /// <summary>
    ///   <para>Sets a global texture property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value">The texture to set.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public static void SetGlobalTexture(string name, Texture value)
    {
      Shader.SetGlobalTextureImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Sets a global texture property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value">The texture to set.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public static void SetGlobalTexture(int nameID, Texture value)
    {
      Shader.SetGlobalTextureImpl(nameID, value);
    }

    /// <summary>
    ///   <para>Sets a global texture property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value">The texture to set.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public static void SetGlobalTexture(
      string name,
      RenderTexture value,
      RenderTextureSubElement element)
    {
      Shader.SetGlobalRenderTextureImpl(Shader.PropertyToID(name), value, element);
    }

    /// <summary>
    ///   <para>Sets a global texture property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value">The texture to set.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public static void SetGlobalTexture(
      int nameID,
      RenderTexture value,
      RenderTextureSubElement element)
    {
      Shader.SetGlobalRenderTextureImpl(nameID, value, element);
    }

    /// <summary>
    ///   <para>Sets a global buffer property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value">The buffer to set.</param>
    public static void SetGlobalBuffer(string name, ComputeBuffer value)
    {
      Shader.SetGlobalBufferImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Sets a global buffer property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value">The buffer to set.</param>
    public static void SetGlobalBuffer(int nameID, ComputeBuffer value)
    {
      Shader.SetGlobalBufferImpl(nameID, value);
    }

    /// <summary>
    ///   <para>Sets a global buffer property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value">The buffer to set.</param>
    public static void SetGlobalBuffer(string name, GraphicsBuffer value)
    {
      Shader.SetGlobalGraphicsBufferImpl(Shader.PropertyToID(name), value);
    }

    /// <summary>
    ///   <para>Sets a global buffer property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="value">The buffer to set.</param>
    public static void SetGlobalBuffer(int nameID, GraphicsBuffer value)
    {
      Shader.SetGlobalGraphicsBufferImpl(nameID, value);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for all shader types.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the constant buffer retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the constant buffer to override.</param>
    /// <param name="value">The buffer to override the constant buffer values with, or null to remove binding.</param>
    /// <param name="offset">Offset in bytes from the beginning of the buffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    public static void SetGlobalConstantBuffer(
      string name,
      ComputeBuffer value,
      int offset,
      int size)
    {
      Shader.SetGlobalConstantBufferImpl(Shader.PropertyToID(name), value, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for all shader types.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the constant buffer retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the constant buffer to override.</param>
    /// <param name="value">The buffer to override the constant buffer values with, or null to remove binding.</param>
    /// <param name="offset">Offset in bytes from the beginning of the buffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    public static void SetGlobalConstantBuffer(
      int nameID,
      ComputeBuffer value,
      int offset,
      int size)
    {
      Shader.SetGlobalConstantBufferImpl(nameID, value, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for all shader types.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the constant buffer retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the constant buffer to override.</param>
    /// <param name="value">The buffer to override the constant buffer values with, or null to remove binding.</param>
    /// <param name="offset">Offset in bytes from the beginning of the buffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    public static void SetGlobalConstantBuffer(
      string name,
      GraphicsBuffer value,
      int offset,
      int size)
    {
      Shader.SetGlobalConstantGraphicsBufferImpl(Shader.PropertyToID(name), value, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for all shader types.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the constant buffer retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the constant buffer to override.</param>
    /// <param name="value">The buffer to override the constant buffer values with, or null to remove binding.</param>
    /// <param name="offset">Offset in bytes from the beginning of the buffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    public static void SetGlobalConstantBuffer(
      int nameID,
      GraphicsBuffer value,
      int offset,
      int size)
    {
      Shader.SetGlobalConstantGraphicsBufferImpl(nameID, value, offset, size);
    }

    public static void SetGlobalFloatArray(string name, List<float> values)
    {
      Shader.SetGlobalFloatArray(Shader.PropertyToID(name), NoAllocHelpers.ExtractArrayFromListT<float>(values), values.Count);
    }

    public static void SetGlobalFloatArray(int nameID, List<float> values)
    {
      Shader.SetGlobalFloatArray(nameID, NoAllocHelpers.ExtractArrayFromListT<float>(values), values.Count);
    }

    /// <summary>
    ///   <para>Sets a global float array property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="values"></param>
    public static void SetGlobalFloatArray(string name, float[] values)
    {
      Shader.SetGlobalFloatArray(Shader.PropertyToID(name), values, values.Length);
    }

    /// <summary>
    ///   <para>Sets a global float array property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="values"></param>
    public static void SetGlobalFloatArray(int nameID, float[] values)
    {
      Shader.SetGlobalFloatArray(nameID, values, values.Length);
    }

    public static void SetGlobalVectorArray(string name, List<Vector4> values)
    {
      Shader.SetGlobalVectorArray(Shader.PropertyToID(name), NoAllocHelpers.ExtractArrayFromListT<Vector4>(values), values.Count);
    }

    public static void SetGlobalVectorArray(int nameID, List<Vector4> values)
    {
      Shader.SetGlobalVectorArray(nameID, NoAllocHelpers.ExtractArrayFromListT<Vector4>(values), values.Count);
    }

    /// <summary>
    ///   <para>Sets a global vector array property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="values"></param>
    public static void SetGlobalVectorArray(string name, Vector4[] values)
    {
      Shader.SetGlobalVectorArray(Shader.PropertyToID(name), values, values.Length);
    }

    /// <summary>
    ///   <para>Sets a global vector array property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="values"></param>
    public static void SetGlobalVectorArray(int nameID, Vector4[] values)
    {
      Shader.SetGlobalVectorArray(nameID, values, values.Length);
    }

    public static void SetGlobalMatrixArray(string name, List<Matrix4x4> values)
    {
      Shader.SetGlobalMatrixArray(Shader.PropertyToID(name), NoAllocHelpers.ExtractArrayFromListT<Matrix4x4>(values), values.Count);
    }

    public static void SetGlobalMatrixArray(int nameID, List<Matrix4x4> values)
    {
      Shader.SetGlobalMatrixArray(nameID, NoAllocHelpers.ExtractArrayFromListT<Matrix4x4>(values), values.Count);
    }

    /// <summary>
    ///   <para>Sets a global matrix array property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="values"></param>
    public static void SetGlobalMatrixArray(string name, Matrix4x4[] values)
    {
      Shader.SetGlobalMatrixArray(Shader.PropertyToID(name), values, values.Length);
    }

    /// <summary>
    ///   <para>Sets a global matrix array property for all shaders.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    /// <param name="values"></param>
    public static void SetGlobalMatrixArray(int nameID, Matrix4x4[] values)
    {
      Shader.SetGlobalMatrixArray(nameID, values, values.Length);
    }

    /// <summary>
    ///   <para>This method is deprecated. Use GetGlobalFloat or GetGlobalInteger instead.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static int GetGlobalInt(string name)
    {
      return (int) Shader.GetGlobalFloatImpl(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>This method is deprecated. Use GetGlobalFloat or GetGlobalInteger instead.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static int GetGlobalInt(int nameID) => (int) Shader.GetGlobalFloatImpl(nameID);

    /// <summary>
    ///   <para>Gets a global float property for all shaders previously set using SetGlobalFloat.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static float GetGlobalFloat(string name)
    {
      return Shader.GetGlobalFloatImpl(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global float property for all shaders previously set using SetGlobalFloat.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static float GetGlobalFloat(int nameID) => Shader.GetGlobalFloatImpl(nameID);

    /// <summary>
    ///   <para>Gets a global integer property for all shaders previously set using SetGlobalInteger.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static int GetGlobalInteger(string name)
    {
      return Shader.GetGlobalIntImpl(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global integer property for all shaders previously set using SetGlobalInteger.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static int GetGlobalInteger(int nameID) => Shader.GetGlobalIntImpl(nameID);

    /// <summary>
    ///   <para>Gets a global vector property for all shaders previously set using SetGlobalVector.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Vector4 GetGlobalVector(string name)
    {
      return Shader.GetGlobalVectorImpl(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global vector property for all shaders previously set using SetGlobalVector.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Vector4 GetGlobalVector(int nameID) => Shader.GetGlobalVectorImpl(nameID);

    /// <summary>
    ///   <para>Gets a global color property for all shaders previously set using SetGlobalColor.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Color GetGlobalColor(string name)
    {
      return (Color) Shader.GetGlobalVectorImpl(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global color property for all shaders previously set using SetGlobalColor.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Color GetGlobalColor(int nameID) => (Color) Shader.GetGlobalVectorImpl(nameID);

    /// <summary>
    ///   <para>Gets a global matrix property for all shaders previously set using SetGlobalMatrix.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Matrix4x4 GetGlobalMatrix(string name)
    {
      return Shader.GetGlobalMatrixImpl(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global matrix property for all shaders previously set using SetGlobalMatrix.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Matrix4x4 GetGlobalMatrix(int nameID) => Shader.GetGlobalMatrixImpl(nameID);

    /// <summary>
    ///   <para>Gets a global texture property for all shaders previously set using SetGlobalTexture.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Texture GetGlobalTexture(string name)
    {
      return Shader.GetGlobalTextureImpl(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global texture property for all shaders previously set using SetGlobalTexture.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Texture GetGlobalTexture(int nameID) => Shader.GetGlobalTextureImpl(nameID);

    /// <summary>
    ///   <para>Gets a global float array for all shaders previously set using SetGlobalFloatArray.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static float[] GetGlobalFloatArray(string name)
    {
      return Shader.GetGlobalFloatArray(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global float array for all shaders previously set using SetGlobalFloatArray.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static float[] GetGlobalFloatArray(int nameID)
    {
      return Shader.GetGlobalFloatArrayCountImpl(nameID) != 0 ? Shader.GetGlobalFloatArrayImpl(nameID) : (float[]) null;
    }

    /// <summary>
    ///   <para>Gets a global vector array for all shaders previously set using SetGlobalVectorArray.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Vector4[] GetGlobalVectorArray(string name)
    {
      return Shader.GetGlobalVectorArray(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global vector array for all shaders previously set using SetGlobalVectorArray.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Vector4[] GetGlobalVectorArray(int nameID)
    {
      return Shader.GetGlobalVectorArrayCountImpl(nameID) != 0 ? Shader.GetGlobalVectorArrayImpl(nameID) : (Vector4[]) null;
    }

    /// <summary>
    ///   <para>Gets a global matrix array for all shaders previously set using SetGlobalMatrixArray.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Matrix4x4[] GetGlobalMatrixArray(string name)
    {
      return Shader.GetGlobalMatrixArray(Shader.PropertyToID(name));
    }

    /// <summary>
    ///   <para>Gets a global matrix array for all shaders previously set using SetGlobalMatrixArray.</para>
    /// </summary>
    /// <param name="nameID">The name ID of the property retrieved by Shader.PropertyToID.</param>
    /// <param name="name">The name of the property.</param>
    public static Matrix4x4[] GetGlobalMatrixArray(int nameID)
    {
      return Shader.GetGlobalMatrixArrayCountImpl(nameID) != 0 ? Shader.GetGlobalMatrixArrayImpl(nameID) : (Matrix4x4[]) null;
    }

    public static void GetGlobalFloatArray(string name, List<float> values)
    {
      Shader.ExtractGlobalFloatArray(Shader.PropertyToID(name), values);
    }

    public static void GetGlobalFloatArray(int nameID, List<float> values)
    {
      Shader.ExtractGlobalFloatArray(nameID, values);
    }

    public static void GetGlobalVectorArray(string name, List<Vector4> values)
    {
      Shader.ExtractGlobalVectorArray(Shader.PropertyToID(name), values);
    }

    public static void GetGlobalVectorArray(int nameID, List<Vector4> values)
    {
      Shader.ExtractGlobalVectorArray(nameID, values);
    }

    public static void GetGlobalMatrixArray(string name, List<Matrix4x4> values)
    {
      Shader.ExtractGlobalMatrixArray(Shader.PropertyToID(name), values);
    }

    public static void GetGlobalMatrixArray(int nameID, List<Matrix4x4> values)
    {
      Shader.ExtractGlobalMatrixArray(nameID, values);
    }

    private Shader()
    {
    }

    [FreeFunction("ShaderScripting::GetPropertyName")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern string GetPropertyName([NotNull("ArgumentNullException")] Shader shader, int propertyIndex);

    [FreeFunction("ShaderScripting::GetPropertyNameId")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetPropertyNameId([NotNull("ArgumentNullException")] Shader shader, int propertyIndex);

    [FreeFunction("ShaderScripting::GetPropertyType")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern ShaderPropertyType GetPropertyType([NotNull("ArgumentNullException")] Shader shader, int propertyIndex);

    [FreeFunction("ShaderScripting::GetPropertyDescription")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern string GetPropertyDescription([NotNull("ArgumentNullException")] Shader shader, int propertyIndex);

    [FreeFunction("ShaderScripting::GetPropertyFlags")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern ShaderPropertyFlags GetPropertyFlags([NotNull("ArgumentNullException")] Shader shader, int propertyIndex);

    [FreeFunction("ShaderScripting::GetPropertyAttributes")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern string[] GetPropertyAttributes([NotNull("ArgumentNullException")] Shader shader, int propertyIndex);

    [FreeFunction("ShaderScripting::GetPropertyDefaultIntValue")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int GetPropertyDefaultIntValue([NotNull("ArgumentNullException")] Shader shader, int propertyIndex);

    [FreeFunction("ShaderScripting::GetPropertyDefaultValue")]
    private static Vector4 GetPropertyDefaultValue([NotNull("ArgumentNullException")] Shader shader, int propertyIndex)
    {
      Vector4 ret;
      Shader.GetPropertyDefaultValue_Injected(shader, propertyIndex, out ret);
      return ret;
    }

    [FreeFunction("ShaderScripting::GetPropertyTextureDimension")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern TextureDimension GetPropertyTextureDimension(
      [NotNull("ArgumentNullException")] Shader shader,
      int propertyIndex);

    [FreeFunction("ShaderScripting::GetPropertyTextureDefaultName")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern string GetPropertyTextureDefaultName([NotNull("ArgumentNullException")] Shader shader, int propertyIndex);

    [FreeFunction("ShaderScripting::FindTextureStack")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool FindTextureStackImpl(
      [NotNull("ArgumentNullException")] Shader s,
      int propertyIdx,
      out string stackName,
      out int layerIndex);

    private static void CheckPropertyIndex(Shader s, int propertyIndex)
    {
      if (propertyIndex < 0 || propertyIndex >= s.GetPropertyCount())
        throw new ArgumentOutOfRangeException(nameof (propertyIndex));
    }

    /// <summary>
    ///   <para>Returns the number of properties in this Shader.</para>
    /// </summary>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern int GetPropertyCount();

    /// <summary>
    ///   <para>Finds the index of a shader property by its name.</para>
    /// </summary>
    /// <param name="propertyName">The name of the shader property.</param>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern int FindPropertyIndex(string propertyName);

    /// <summary>
    ///   <para>Returns the name of the shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public string GetPropertyName(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return Shader.GetPropertyName(this, propertyIndex);
    }

    /// <summary>
    ///   <para>Returns the nameId of the shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public int GetPropertyNameId(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return Shader.GetPropertyNameId(this, propertyIndex);
    }

    /// <summary>
    ///   <para>Returns the ShaderPropertyType of the property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public ShaderPropertyType GetPropertyType(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return Shader.GetPropertyType(this, propertyIndex);
    }

    /// <summary>
    ///   <para>Returns the description string of the shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public string GetPropertyDescription(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return Shader.GetPropertyDescription(this, propertyIndex);
    }

    /// <summary>
    ///   <para>Returns the ShaderPropertyFlags of the shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public ShaderPropertyFlags GetPropertyFlags(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return Shader.GetPropertyFlags(this, propertyIndex);
    }

    /// <summary>
    ///   <para>Returns an array of strings containing attributes of the shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public string[] GetPropertyAttributes(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return Shader.GetPropertyAttributes(this, propertyIndex);
    }

    /// <summary>
    ///   <para>Returns the default float value of the shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public float GetPropertyDefaultFloatValue(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      ShaderPropertyType propertyType = this.GetPropertyType(propertyIndex);
      if (propertyType != ShaderPropertyType.Float && propertyType != ShaderPropertyType.Range)
        throw new ArgumentException("Property type is not Float or Range.");
      return Shader.GetPropertyDefaultValue(this, propertyIndex)[0];
    }

    /// <summary>
    ///   <para>Returns the default Vector4 value of the shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public Vector4 GetPropertyDefaultVectorValue(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      ShaderPropertyType propertyType = this.GetPropertyType(propertyIndex);
      if (propertyType != ShaderPropertyType.Color && propertyType != ShaderPropertyType.Vector)
        throw new ArgumentException("Property type is not Color or Vector.");
      return Shader.GetPropertyDefaultValue(this, propertyIndex);
    }

    /// <summary>
    ///   <para>Returns the min and max limits for a &lt;a href="Rendering.ShaderPropertyType.Range.html"&gt;Range&lt;/a&gt; property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public Vector2 GetPropertyRangeLimits(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      Vector4 vector4 = this.GetPropertyType(propertyIndex) == ShaderPropertyType.Range ? Shader.GetPropertyDefaultValue(this, propertyIndex) : throw new ArgumentException("Property type is not Range.");
      return new Vector2(vector4[1], vector4[2]);
    }

    /// <summary>
    ///   <para>Returns the TextureDimension of a &lt;a href="Rendering.ShaderPropertyType.Texture.html"&gt;Texture&lt;/a&gt; shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public TextureDimension GetPropertyTextureDimension(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return this.GetPropertyType(propertyIndex) == ShaderPropertyType.Texture ? Shader.GetPropertyTextureDimension(this, propertyIndex) : throw new ArgumentException("Property type is not TexEnv.");
    }

    /// <summary>
    ///   <para>Returns the default Texture name of a &lt;a href="Rendering.ShaderPropertyType.Texture.html"&gt;Texture&lt;/a&gt; shader property at the specified index.</para>
    /// </summary>
    /// <param name="propertyIndex">The index of the shader property.</param>
    public string GetPropertyTextureDefaultName(int propertyIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return this.GetPropertyType(propertyIndex) == ShaderPropertyType.Texture ? Shader.GetPropertyTextureDefaultName(this, propertyIndex) : throw new ArgumentException("Property type is not Texture.");
    }

    public bool FindTextureStack(int propertyIndex, out string stackName, out int layerIndex)
    {
      Shader.CheckPropertyIndex(this, propertyIndex);
      return this.GetPropertyType(propertyIndex) == ShaderPropertyType.Texture ? Shader.FindTextureStackImpl(this, propertyIndex, out stackName, out layerIndex) : throw new ArgumentException("Property type is not Texture.");
    }

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void get_keywordSpace_Injected(out LocalKeywordSpace ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void EnableKeywordFast_Injected(ref GlobalKeyword keyword);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void DisableKeywordFast_Injected(ref GlobalKeyword keyword);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetKeywordFast_Injected(ref GlobalKeyword keyword, bool value);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern bool IsKeywordEnabledFast_Injected(ref GlobalKeyword keyword);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalVectorImpl_Injected(int name, ref Vector4 value);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void SetGlobalMatrixImpl_Injected(int name, ref Matrix4x4 value);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetGlobalVectorImpl_Injected(int name, out Vector4 ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetGlobalMatrixImpl_Injected(int name, out Matrix4x4 ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetPropertyDefaultValue_Injected(
      Shader shader,
      int propertyIndex,
      out Vector4 ret);
  }
}
